<?php
/* @var $this SaleController */
/* @var $model Sale */

$this->breadcrumbs=array(
	'[销售记录]管理'=>array('admin'),
	'导入[销售记录]',
);
//设置页面标题
$this->pageTitle=Yii::app()->name.' - 导入[销售记录]';
$this->contentTitle='导入[销售记录]';
?>
<!--表单内容-->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'sale-form',
	'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>true
        ),
    'htmlOptions'=>array('class'=>'ajax_form'),
)); ?>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl?>/editor/kindeditor-min.js"></script>
<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl?>/editor/themes/default/default.css" />
<table cellspacing="1" class="myform">
	   <tr>
          <td align="right">导入文件：</td> 
          <td>
              <input class="ke-input-text" type="text" name="userfile" id="url" value="" readonly="readonly" />
                <input type="button" id="uploadButton" value="上传文件" />
          </td>
        </tr>

	<tr>
        <td align="right"></td>
        <td>
            <input class="but" type="submit" name="yt0" value="提 交" />        </td>
    </tr>
</table>
<script>
	KindEditor.ready(function(K) {
                var uploadbutton = K.uploadbutton({
                        button : K('#uploadButton')[0],
                        fieldName : 'imgFile',
                        url : '<?php echo Yii::app()->baseUrl?>/editor/php/upload_json.php?dir=excel',
                        afterUpload : function(data) {
                                if (data.error === 0) {
                                       var url = K.formatUrl(data.url, 'absolute');
					K('#url').val(url);
                                } else {
                                        alert(data.message);
                                }
                        },
                        afterError : function(str) {
                                alert('自定义错误信息: ' + str);
                        }
                });
                uploadbutton.fileBox.change(function(e) {
                        uploadbutton.submit();
                });
                var uploadbuttons = K.uploadbutton({
                        button : K('#uploadButtons')[0],
                        fieldName : 'imgFile',
                        url : '<?php echo Yii::app()->baseUrl?>/editor/php/upload_json.php?dir=image',
                        afterUpload : function(data) {
                                if (data.error === 0) {
                                       var url = K.formatUrl(data.url, 'absolute');
					K('#Party_head_image').val(url);
                                } else {
                                        alert(data.message);
                                }
                        },
                        afterError : function(str) {
                                alert('自定义错误信息: ' + str);
                        }
                });
                uploadbuttons.fileBox.change(function(e) {
                        uploadbuttons.submit();
                });                
        });
</script>
<?php $this->endWidget(); ?>
<!--表单内容-->
